home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / closedevice.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  91 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: closedevice.c,v 1.5 1996/10/24 15:50:46 aros Exp $
  4.     $Log: closedevice.c,v $
  5.     Revision 1.5  1996/10/24 15:50:46  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.4  1996/08/13 13:55:59  digulla
  9.     Replaced AROS_LA by AROS_LHA
  10.     Replaced some AROS_LH*I by AROS_LH*
  11.     Sorted and added includes
  12.  
  13.     Revision 1.3  1996/08/01 17:41:07  digulla
  14.     Added standard header for all files
  15.  
  16.     Desc:
  17.     Lang: english
  18. */
  19. #include <exec/execbase.h>
  20. #include <exec/io.h>
  21. #include <dos/dos.h>
  22. #include <aros/libcall.h>
  23.  
  24. /*****************************************************************************
  25.  
  26.     NAME */
  27.     #include <clib/exec_protos.h>
  28.  
  29.     AROS_LH1(void, CloseDevice,
  30.  
  31. /*  SYNOPSIS */
  32.     AROS_LHA(struct IORequest *, iORequest, A1),
  33.  
  34. /*  LOCATION */
  35.     struct ExecBase *, SysBase, 75, Exec)
  36.  
  37. /*  FUNCTION
  38.     Closes a previously opened device. Any outstanding I/O requests must
  39.     be finished. It is safe to call CloseDevice with a cleared iorequest
  40.     structure or one that failed to open.
  41.  
  42.     INPUTS
  43.     iORequest - Pointer to iorequest structure.
  44.  
  45.     RESULT
  46.  
  47.     NOTES
  48.  
  49.     EXAMPLE
  50.  
  51.     BUGS
  52.  
  53.     SEE ALSO
  54.     OpenDevice().
  55.  
  56.     INTERNALS
  57.  
  58.     HISTORY
  59.  
  60. ******************************************************************************/
  61. {
  62.     AROS_LIBFUNC_INIT
  63.  
  64.     /* Single-thread the close routine. */
  65.     Forbid();
  66.  
  67.     /* Something to do? */
  68.     if(iORequest->io_Device!=NULL)
  69.     {
  70.     (void)AROS_LVO_CALL1(BPTR,
  71.         AROS_LCA(struct IORequest *,iORequest, A1),
  72.         struct Device *,iORequest->io_Device,2,
  73.     );
  74.     /*
  75.         Normally you'd expect the device to be expunged if this returns
  76.         non-zero, but this is only exec which doesn't know anything about
  77.         seglists - therefore dos.library has to SetFunction() into this
  78.         vector for the additional functionality.
  79.     */
  80.  
  81.     /* Trash device field */
  82.     iORequest->io_Device=(struct Device *)-1;
  83.     }
  84.  
  85.     /* All done. */
  86.     Permit();
  87.  
  88.     AROS_LIBFUNC_EXIT
  89. } /* CloseDevice */
  90.  
  91.